let user = {
    avatar:"",
    nickname : ""
}


loginbtn.onclick = function(){

    user.nickname = nick_name.value;
    // 判断用户是否选择头像 和输入昵称，
    if(user.avatar && user.nickname  && user.nickname.length >= 2 && user.nickname.length < 16){
        document.querySelector(".login-page").classList.add('hide')
        document.querySelector(".container").classList.remove('hide')
    }else{
        alert("请选择头像，输入昵称")
    }
}



const selectAvatar = document.querySelector(".select-avatar")
selectAvatar.onclick = function(e){

    document.querySelector(".selected").classList.remove("selected")

    let target = e.target;
    target.classList.add("selected")
    user.avatar = target.src;
}